---
layout: m1x_soap
title: Set For Quote Item
---

<h3><a name="giftmessage.setForQuoteItem-Module%3AGiftMessageAPI"></a>Module: GiftMessage API</h3>

<h4><a name="giftmessage.setForQuoteItem-Resource%3Agiftmessage"></a>Resource: giftmessage</h4>

<h5><a name="giftmessage.setForQuoteItem-Method%3A"></a>Method:</h5>

<ul>
	<li>giftmessage.setForQuoteItem (SOAP V1)</li>
	<li>giftMessageSetForQuoteItem (SOAP V2)</li>
</ul>


<p>Allows you to set a gift message for an item in the shopping cart (quote).</p>

<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string </td>
<td> quoteItemId </td>
<td> Shopping cart (quote) item ID </td>
</tr>
<tr>
<td> array </td>
<td> giftMessage </td>
<td> Array of giftMessageEntity </td>
</tr>
<tr>
<td> string </td>
<td> store </td>
<td> Store view ID or code (optional) </td>
</tr>
</tbody></table>


<p><b>Return:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> array </td>
<td> result </td>
<td> giftMessageResponse </td>
</tr>
</tbody></table>


<p>The <b>giftMessageEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> from <br class="atl-forced-newline" /> </td>
<td> Gift message sender </td>
</tr>
<tr>
<td> string </td>
<td> to <br class="atl-forced-newline" /> </td>
<td> Gift message recipient </td>
</tr>
<tr>
<td> string </td>
<td> message <br class="atl-forced-newline" /> </td>
<td> Gift message </td>
</tr>
</tbody></table>


<p>The <b>giftMessageResponse</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> entityId <br class="atl-forced-newline" /> </td>
<td> Entity ID </td>
</tr>
<tr>
<td> boolean </td>
<td> result <br class="atl-forced-newline" /> </td>
<td> Result of adding a message </td>
</tr>
<tr>
<td> string </td>
<td> error <br class="atl-forced-newline" /> </td>
<td> Error </td>
</tr>
</tbody></table>



<h4><a name="giftmessage.setForQuoteItem-Examples"></a>Examples</h4>

<h5><a name="giftmessage.setForQuoteItem-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');

$result = $client-&gt;call($session, 'giftmessage.setForQuoteItem', array('quoteItemId' =&gt; '1', 'giftMessage' =&gt; array('from' =&gt; 'John', 'to' =&gt; 'Sara', 'message' =&gt; 'Gift message text')));
var_dump ($result);</pre>
		</div>
</div></div>



<h5><a name="giftmessage.setForQuoteItem-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); 
 
$result = $proxy-&gt;giftMessageSetForQuoteItem($sessionId, '1', array(
'from' =&gt; 'John',
'to' =&gt; 'Sara',
'message' =&gt; 'Gift message text'
));  
 
var_dump($result);</pre>
		</div>
</div></div>


<h5><a name="giftmessage.setForQuoteItem-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;giftMessageSetForQuoteItem((object)array('sessionId' =&gt; $sessionId-&gt;result, 'quoteItemId' =&gt; '1', 'giftMessage' =&gt; array(
'from' =&gt; 'John',
'to' =&gt; 'Sara',
'message' =&gt; 'Gift message text'
)));  
 
var_dump($result);</pre>
		</div>
</div></div>

<h5><a name="giftmessage.setForQuoteItem-ResponseExampleSOAPV1"></a>Response Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">array
  'entityId' =&gt; string '1' (length=1)
  'result' =&gt; boolean true
  'error' =&gt; string '' (length=0)</pre>
		</div>
</div></div>


